<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><{$site_title}>管理中心</title>
<{include file="js.html"}>
<link type="text/css" rel="stylesheet" href="css/validator.css"></link>
<script src="js/formValidator.js" type="text/javascript"></script>
<script src="js/formValidatorRegex.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
  	$("#myForm").submit(function(){
  		//用户名
  		var account= $("input[name='account']").val();	
  		var pattern = /^[a-zA-Z0-9]\w{3,11}$/;
  		if(!pattern.test(account)){
            alert('用户名只能为4-12的数字+字母组成');
            return false;
        }else{
        	//AJAX验证唯一性  
	        var yes = false; // 设置验证不通过
	        $.ajax({
	            type: "POST", 
	             url: "user_add.php?action=checkAccount", 
	            data: {account:account},
	            async: false, 
	            dataType: "json",
	            success: function (result) {
	                if(result.error=='1'){
	                    alert(result.msg);
	                }else if(result.error=='0'){
	                    yes = true;
	                }
	            }
	        }); 
	        if(yes==false){return false;}
        }
        //密码
        var pwd=$("input[name='pwd']").val();
        var pattern=/^[\w]{4,12}$/;
        if(!pattern.test(pwd)){
            alert('密码格式为4-12数字/字母组成');
            return false;
        }
        //确认密码
        var repwd=$("input[name='pwd2']").val();
        if(pwd!=repwd){
                alert('两次密码不一致');
                return false;
         }

  		return queding('是否保存设置？',".subCheck");
  	});
})
</script>
</head>

<body>
<div class="box">
<div style="background:url(images/mainbj.jpg) repeat-x; line-height:31px; height:31px;">
<table width="262" height="31" border="0" cellpadding="0" cellspacing="0">
<tr><td width="41" align="center">
<img src="images/biao1.jpg" /></td>
<td width="221"><strong>当前位置</strong>：会员管理 &gt; 添加会员</td>
</tr></table>
</div>
<{if $user.id>0}>
<table class="lefttab" cellpadding="0" cellspacing="0">
<tbody>
<tr><td height="50px" class="xiugai">
<a style="float:left; margin-left:5px;" href="user_add.php?id=<{$smarty.get.id}>"><div class="inp2 inp">基本信息</div></a>
<a style="float:left; margin-left:5px;" href="user_educate.php?id=<{$smarty.get.id}>"><div class="inp2">教育经历</div></a>
<a style="float:left; margin-left:5px;" href="user_oversea.php?id=<{$smarty.get.id}>"><div class="inp2">海外经历</div></a>
<a style="float:left; margin-left:5px;" href="user_work.php?id=<{$smarty.get.id}>"><div class="inp2">工作经历</div></a>
</td>
  </tr>
</tbody></table>
<{/if}>
<form action="" method="post" name="myForm" id="myForm" enctype='multipart/form-data'>
<table class="lefttab" cellpadding="0" cellspacing="0">
<tr><td colspan="3"><div style="height:26px; text-align:left; line-height:26px; background:url(images/xbj1.jpg) repeat-x; border:1px solid #e9f5fa;font-weight:bold;">&nbsp;&nbsp;添加会员</div>
</td></tr>
<tr>
  <td width="100" align="right"><font color="#e47c02">*</font> <strong>账号</strong>：</td>
  <td width="310" align="left">&nbsp;<input type="text" name="account" id="name" size="20" value="<{$user.account}>" class="subCheck"/></td>
</tr>
<{if $user.id==''}>
<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>密码</strong>：</td>
  <td align="left">&nbsp;<input type="password" name="pwd" id="pwd"  class="subCheck"/></td>
</tr>
<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>重复密码</strong>：</td>
  <td align="left">&nbsp;<input type="password" name="pwd2" id="pwd2" class="subCheck"/></td>
</tr>
<{/if}>
<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>手机号</strong>：</td>
  <td width="673" align="left">&nbsp;<input type="text" name="phone" class="subCheck" value="<{$user.phone}>"/></td>
</tr>
<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>邮箱</strong>：</td>
  <td width="673" align="left">&nbsp;<input type="text" name="email" class="subCheck" value="<{$user.email}>"/></td>
</tr>
<tr>
  <td width="100" align="right"><font color="#e47c02">*</font> <strong>真实姓名</strong>：</td>
  <td width="310" align="left">&nbsp;<input type="text" name="real_name" size="20" value="<{$user.real_name}>" class="subCheck"/></td>
</tr>
<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>头像</strong>：</td>
  <td width="673" align="left">&nbsp;<input type="file" name="avatar" class="subCheck" /></td>
</tr>
<{if $user.avatar!=''}>
<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>头像预览</strong>：</td>
  <td width="673" align="left">&nbsp;<img src="../upload/user/large/<{$user.avatar}>" width="200px" height="200px"></td>
</tr>
<{/if}>
<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>性别</strong>：</td>
  <td align="left">&nbsp;<input type="radio" <{if $user.sex=='male'}>checked="checked"<{/if}> name="sex" value="male"> 男<input type="radio" <{if $user.sex=='female'}>checked="checked"<{/if}> name="sex" value="female">女</td>
</tr>
<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>居住地址</strong>：</td>
  <td align="left">&nbsp;<input type="text" name="address" value="<{$user.address}>"> </td>
</tr>
<tr>
  <td align="right"><font color="#e47c02">*</font> <strong>自我简介</strong>：</td>
  <td align="left">&nbsp;<textarea name="self_intro"  rows="10" cols="50" value="" class="subCheck"><{$user.self_intro}></textarea> </td>
</tr>

<!-- <tr>
  <td align="right"><font color="#e47c02">*</font> <strong>角色</strong>：</td>
  <td align="left">&nbsp;
  <select  name="group_id"  class="subCheck">
	<option value="">请选择角色</option>
	<{foreach item=loop from=$admin_group}>
	  <option value="<{$loop.id}>"><{$loop.group_name}></option>
	<{/foreach}>
  </select>
  </td>
</tr> -->
<tr><td height="50px" colspan="2">
	<p>&nbsp;</p>
    <p align="left" style="margin-left:100px;">
      &nbsp;&nbsp;<input type="submit" name="submit" value="保存" class="inp"/>
      </p>    <p>&nbsp;</p></td>
  </tr>
</table>
</form>

</div>
</body>
</html>